<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title">分享管理</h3>
    </div>
    <div class="well">
        <form class="form-inline" role="form">
            <div class="form-group">
                <label class="control-label" for="name">email</label>
                <input type="text" class="form-control" id="email" name="email" value="<?php echo $email?>" placeholder="请输入email">
            </div>
            <div class="form-group">
                <label class="control-label" for="name">专辑</label>
                <input type="text" class="form-control" id="album" name="album" value="<?php echo $album?>"
                       placeholder="请输入专辑">
            </div>
            <div class="form-group">
                <label class="control-label" for="name">标题</label>
                <input type="text" class="form-control" id="title" name="title" value="<?php echo $title?>"
                       placeholder="请输入标题">
            </div>
            <button type="submit" class="btn btn-info"> 查询</button>
        </form>
        <div class="pagination">
            <button type="button" class="btn btn-primary" id="add_item">
                添加
            </button>
            <button type="button" class="btn btn-primary" id="remove_items">
                删除
            </button>
        </div>
    </div>
    <div class="panel-body">
        <table class="table table-condensed table-striped">
            <thead>
            <tr>
                <th><input type="checkbox" class="rows_check" /> </th>
                <th>编号</th>
                <th>发布人</th>
                <th>描述</th>
                <th>图片</th>
                <th>专辑</th>
                <th>标签</th>
                <th>地址</th>
                <th>价格</th>
                <th>曝光量</th>
                <th>浏览量</th>
                <th>评论量</th>
                <th>是否启用</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
                <?php if(isset($postList['rows'])):?>
                <?php foreach($postList['rows'] as $key=>$list):?>
                <tr>
                    <td><input type="checkbox" class="row_check" data-id="<?php echo $list['id'] ?>" /></td>
                    <td><?php echo $key+1 ?></td>
                    <td><?php echo $list['user_email'] ?></td>
                    <td><?php echo $list['description'] ?></td>
                    <td>
                        <?php 
                            $image_list = explode(";", $list['images']);
                            foreach($image_list as $img){
                                if(!empty($img)){

                                   echo  '<p><img src="'.Lib_Image::getPostImage($list['id'],$img,100).'"  /></p>';

                                }
                            }
                        ?>
                    </td>
                    <td><?php echo $list['album'] ?></td>
                    <td><?php echo $list['tags'] ?></td>
                    <td><?php echo $list['url'] ?></td>
                    <td><?php echo $list['price'] ?></td>
                    <td><?php echo $list['reach'] ?></td>
                    <td><?php echo $list['view'] ?></td>
                    <td><?php echo $list['review'] ?></td>
                    <td><?php echo $list['isdisabled']=="1"?"否":"是" ?></td>
                    <td><?php echo $list['created'] ?></td>
                    <td>
                        <button type="button" class="btn btn-primary update_item" data-albumid="<?php echo $list['albumid'] ?>"  data-album="<?php echo $list['album'] ?>" data-userid="<?php echo $list['userid'] ?>" data-id="<?php echo $list['id'] ?>">
                            修改
                        </button>
                        <button type="button" class="btn btn-primary remove_item"  data-id="<?php echo $list['id'] ?>">
                            删除
                        </button>
                        <button type="button" class="btn btn-primary upload_image"  data-id="<?php echo $list['id'] ?>">
                            上传图片
                        </button>
                    </td>
                </tr>
                <?php endforeach; ?>
            <?php endif;?>
            </tbody>
        </table>
        <?php if($pages>1):?>
            <div class="well well-sm pager" style="text-align: center"><?php echo HTML::getPageHtml($page,$pages,$url)?></div>
        <?php endif;?>
    </div>
</div>
<div class="modal fade" id="list_modal" tabindex="-1" role="dialog" model="post"
    aria-labelledby="myModalLabel" aria-hidden="true"  style="top:50px;width:800px">
    <div class="modal-dialog" style="width:760px;top:0px;margin-top:0px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                   分享信息
                </h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="list_form" name="list_form">
                    <div class="form-group">
                        <input type="hidden" class="form-control" id="model_id" name="model_id" />
                    </div>
                    <div class="form-group">
                        <label for="userid" class="col-sm-2 control-label">用户</label>
                        <div class="col-sm-10">
                            <select name="userid" id="userid"  class="form-control">
                                <?php if(!empty($users)):?>
                                <?php foreach($users as $u=>$ulist):?>
                                <option value="<?php echo $ulist['id'];?>"><?php echo $ulist['username'];?></option>
                                <?php endforeach;?>
                                <?php endif;?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="album" class="col-sm-2 control-label">专辑</label>
                        <div class="col-sm-10">
                            <select name="album" id="c_album"  class="form-control">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="description" class="col-sm-2 control-label">描述</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="description" name="description"
                                   placeholder="请输入描述">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="email" class="col-sm-2 control-label">地址</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="url" name="url"
                                   placeholder="请输入地址">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="email" class="col-sm-2 control-label">标签</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="tags" name="tags"
                                   placeholder="请输入标签">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="email" class="col-sm-2 control-label">价格</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="price" name="price"  />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="email" class="col-sm-2 control-label">是否启用</label>
                        <div class="col-sm-10">
                            <select name="isdisabled" id="isdisabled"  class="form-control">
                                <option value="0">是</option>
                                <option value="1">否</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" id="saveForm" class="btn btn-primary">
                    保存
                </button>
            </div>
        </div>
    </div>
  </div>
<div class="modal fade" id="upload_modal" tabindex="-1" role="dialog" model="post"
    aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    上传图片
                </h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="image_form" name="image_form">
                    <div class="form-group">
                        <input type="hidden" class="form-control" id="upload_id" name="upload_id" />
                        <input type="hidden" class="form-control" id="filename" name="name" value="image" />
                        <input type="hidden" class="form-control"  name="model" value="post" />
                    </div>
                    <div class="form-group">
                        <label for="image" class="col-sm-2 control-label">图片地址</label>
                        <div class="col-sm-10">
                            <input type="file" id="image" name="image" />
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" id="saveImage" class="btn btn-primary">
                    上传
                </button>
            </div>
        </div>
    </div>
</div>